<template>
	<view class="personalInfo  ">

		<view class="personalBox bgWhite radius8">

			<uv-form labelPosition="left" :model="personaModel"  :labelStyle="labelStyle"
				ref="form">
				<uv-form-item label="收款人" borderBottom prop="personaModel.name" labelWidth="140rpx">
					<uv-input :disabled="disable"  inputAlign="right" v-model="personaModel.name" border="none" placeholder="请输入">
					</uv-input>
				</uv-form-item>
				<uv-form-item label="开户银行" borderBottom prop="personaModel.kaihuname" labelWidth="140rpx">
					<uv-input :disabled="disable"  inputAlign="right" v-model="personaModel.kaihuname" border="none" placeholder="例如**市**区/县**大道**银行">
					</uv-input>
				</uv-form-item>
				<uv-form-item label="银行卡号"  borderBottom prop="personaModel.kahao" labelWidth="140rpx">
					<uv-input :disabled="disable"  inputAlign="right" v-model="personaModel.kahao" border="none" placeholder="请输入">
					</uv-input>
				</uv-form-item>
				<uv-form-item label="联系电话"  prop="personaModel.mobile" labelWidth="140rpx">
					<uv-input :disabled="disable" inputAlign="right" v-model="personaModel.mobile" border="none" placeholder="请输入">
					</uv-input>
				</uv-form-item>
				
			</uv-form>
		</view>
		<view class=" bgWhite radius6 mt12" style="padding: 32rpx 0 40rpx 26rpx;">
			<view class="">
				提现金额
			</view>
			<view class="justify-center align-center moenyinput">
					￥<uv-input :disabled="disable"  inputAlign="left" fontSize="30px" customStyle="height: 60rpx;" v-model="personaModel.amount" border="none" placeholder="请输入">
				</uv-input>
				<text style="color: #DFC199;" @click="actAll">全部提现</text>
			</view>
			<view class="ft12" style="color: #A1A1A1;">
				可提现金额：￥ {{money}}
			</view>
		</view>
		<view class="save_btn" @click="save">
			{{disable?'审核中':'提交'}}
		</view>
		
	</view>
</template>

<script>
	import operate from '@/common/operate.js'
	export default {
		data() {
			return {
				labelStyle: {
					'height': '87rpx',
					'font-size': "30rpx",
					'color': '#000'
				},
				personaModel: {
					name: "",
					kahao: '',
					mobile: "",
					amount:"",
					kaihuname:""
				
				},
				personalRules: {
					'name': {
						type: 'string',
						required: true,
						message: '请填写姓名',
						trigger: ['blur', 'change']
					},
					'idcode': {
						type: 'string',
						required: true,
						message: '请填写身份证号',
						trigger: ['blur', 'change']
					},
					'address': {
						type: 'string',
						required: true,
						message: '请填写地址',
						trigger: ['blur', 'change']
					},
					// 'personaModel.sfz1': {
					// 	type: 'string',
					// 	required: true,
					// 	message: '请上传身份证正反面照片',
					// 	trigger: ['blur', 'change']
					// },
					

				},
				areaRrand: [
					[],
					[]
				],
				columnData: [],
				area: "",
				checkboxValue: [],
				cateList: [],
				money:"",
				disable:false
			};
		},
		onReady() {
		},
		onLoad() {
				this.$api.userprice().then(res=>{
					this.money= res.data.money
					console.log(res)
				})
				this.$api.getwithdrawal().then(res=>{
					console.log(res)
					if(res.code==1){
						this.disable=false
						
					}else{
						this.disable = true
					}
				})
			
		},
		methods: {
			actAll(){
					this.personaModel.amount=this.money
			},
			async save() {
				if(this.disable) return
				if(!this.personaModel.name) return this.$utils.msg('请输入收款人')
				if(!this.personaModel.kaihuname) return this.$utils.msg('请输入开户银行')
				
				if(!this.personaModel.kahao) return this.$utils.msg('请输入银行卡号')
				if(!this.personaModel.mobile) return this.$utils.msg('请输入手机号码')
				
				if (!this.$utils.checkStr(this.personaModel.mobile, 'mobile')) return this.$utils.msg('请输入正确的手机号码')
				if(!this.personaModel.amount) return this.$utils.msg('请输入提现金额')
					this.$api.withdrawal(this.personaModel).then(res=>{
						console.log(res)
						if(res.code==1){
							this.$utils.msg(res.msg)
							setTimeout(()=>{
								uni.navigateBack()
							},800)
						}else{
							this.$utils.msg(res.msg)
						}
					})
			},


		}
	}
</script>
<style>
	page {
		background-color: #f5f5f5;
	}
</style>
<style lang="scss" scoped>
	.header {
		margin-top: 52rpx;
		margin-bottom: 40rpx;
		font-weight: 600;
		font-size: 36rpx;
		color: #000000;
		line-height: 36rpx;

	}

	.personalInfo {

		padding: 22rpx;
		position: relative;

		.personalBox {
			padding: 0 32rpx ;

		}

		.save_btn {
			width: 100%;
			height: 90rpx;
			margin-top: 38rpx;
			margin-bottom: 40rpx;
			background: #49806F;
			border-radius: 55rpx;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 90rpx;
		}

	}

	button {
		color: #303133;
		font-size: 28rpx;
		text-align: left;
	}

	image {
		width: 300rpx;
		height: 250rpx;

	}

	.textbox {
		width: 300rpx;
		height: 51rpx;
		background: #DFC199;
		border-radius: 0 0 10rpx 10rpx;
		font-weight: 400;
		font-size: 23rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 51rpx;
		bottom: 0;
		left: 0;
	}
	.moenyinput{
		padding:50rpx 27rpx 35rpx 0;
		margin-bottom: 28rpx;
		border-bottom: 1rpx solid #F2f2f2;
	}
	
	/deep/ input{
		height: 60rpx!important;
	}
</style>